package org.jmh.gift.strategy.impl;

import org.jmh.gift.domain.GoodsSku;
import org.jmh.gift.strategy.IPlaceOrderSplitOrderStrategy;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 按照店铺做拆单 - 其实就是按照店铺对sku信息做分组
 */
public class PlaceOrderSplitOrderByTenantStrategy implements IPlaceOrderSplitOrderStrategy {
    @Override
    public Map<Long, List<GoodsSku>> splitOrder(List<GoodsSku> skus) {
        return skus.stream().collect(Collectors.groupingBy(GoodsSku::getTenantId));
    }
}
